package cn.com.dashihui.api.radisysnc.request;

import cn.com.dashihui.api.dao.Goods;
import cn.com.dashihui.api.dao.OrderG;
import cn.com.dashihui.api.radisysnc.inter.IGoodsBiz;
import cn.com.dashihui.api.radisysnc.inter.IRequest;
/**
 * ***********************************************
　 * <p>类名: InventoryQueryCacheRequest</p> 
　 * <p>描述: 查询缓存数据     1、从数据库中查询  2、从数据库中查询后插入到缓存中</p> 
　 * @author niufc 
　 * @date 2019年8月19日 
  * ************************************************
 */
public class InventoryQueryCacheRequest implements IRequest{
	
	private IGoodsBiz inventoryGoodsBiz;
    private Integer goodsId;
    private String orderNum;
    private boolean isForceFefresh;
    
    //good构造查询请求
    public InventoryQueryCacheRequest(Integer goodsId,IGoodsBiz inventoryGoodsBiz,boolean isForceFefresh) {
        this.goodsId = goodsId;
        this.inventoryGoodsBiz = inventoryGoodsBiz;
        this.isForceFefresh = isForceFefresh;
    }
    //order构造查询请求
    public InventoryQueryCacheRequest(String orderNum,IGoodsBiz inventoryGoodsBiz,boolean isForceFefresh) {
        this.orderNum = orderNum;
        this.inventoryGoodsBiz = inventoryGoodsBiz;
        this.isForceFefresh = isForceFefresh;
    }

	@Override
	public void process() {
		 Goods  goods = inventoryGoodsBiz.loadGoodsByGoodsId(goodsId);
	      inventoryGoodsBiz.setGoodsCache(goods);
	}
	@Override
	public void processOrderG() {
		OrderG order = inventoryGoodsBiz.loadOrderG(orderNum);
		inventoryGoodsBiz.setOrderGCache(order);
	}

	@Override
	public Integer getGoodsId() {
		return goodsId;
	}

	@Override
	public boolean isForceFefresh() {
		return isForceFefresh;
	}
	
	public void setForceFefresh(boolean isForceFefresh) {
        this.isForceFefresh = isForceFefresh;
    }


	@Override
	public String getOrderNum() {
		return orderNum;
	}
	


}
